package com.ruoyi.audit.controller;

import com.ruoyi.audit.domain.BusCarPackageAudit;
import com.ruoyi.audit.domain.vo.HandleAuditParam;
import com.ruoyi.audit.domain.vo.StartAuditParam;
import com.ruoyi.audit.service.IBusCarPackageAuditService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 审核信息Controller
 *
 * @author ruoyi
 * @date 2023-11-02
 */
@RestController
@RequestMapping("/audit/todo")
public class CarPackageAuditTodoController extends BaseController {
    @Autowired
    private IBusCarPackageAuditService busCarPackageAuditService;

    /**
     * 查询审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('audit:todo:list')")
    @GetMapping("/list")
    public TableDataInfo list() {
//        startPage();
        List<BusCarPackageAudit> list = busCarPackageAuditService.selectAuditTodoList();
        return getDataTable(list);
    }

    /**
     * 审批功能实现
     * @param handleAuditParam
     * @return
     */
    @PreAuthorize("@ss.hasAnyPermi('audit:todo:handle')")
    @PutMapping ("/handle")
    public AjaxResult handleAudit(@RequestBody HandleAuditParam handleAuditParam){
        busCarPackageAuditService.handleAudit(handleAuditParam);
        return success();
    }
}
